package endpoint

import (
	"context"
	"dssh/models"
	"dssh/service"
	"github.com/go-kit/kit/endpoint"
)

func GetCustomEndPoint(customService service.ICustomService) endpoint.Endpoint {
	return func(ctx context.Context, request interface{}) (response interface{}, err error) {
		r := request.(models.ModelCustomRequest) //todo 获取请求数据

		//调用service 获取结果，
		_, err = customService.Execute(r)
		if err != nil {
			return models.ModelCustomResponse{Code: 500, Message: err.Error()}, nil
		}
		return models.ModelCustomResponse{200, "执行成功"}, nil
	}
}
